class BuildDpd
  include DailyProjectDetails
  
  def initialize(document)
    @name = 'Build' 
    @document = document
    @data = Array.new
    parse_document
  end
  
  def parse_document
    #[1] Get the project that this dpd is associated with.
    REXML::XPath.each(@document, '/' + @name + "DailyProjectData") do |e|
      @project = "#{e.attributes['Project']}"
    end
    
    #[2] Get the UnitTest data associated with the project.
    REXML::XPath.each(@document, '/' + @name + "DailyProjectData/MemberData") do |e|
      successful_builds = "#{e.attributes['success']}"
      failed_builds = "#{e.attributes['failure']}"
      
      data = SensorData.new
      data.add_mapping('success', successful_builds)
      data.add_mapping('failure', failed_builds)
      @data.push(data)
    end
  end
end